package com.likui.myqq.util;

import android.content.Context;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;

/**
 * Created by helikui on 2015/9/30.
 */
public class SDManager {
    private Context mContext;
    private String[] names = {"songhuiqiao.jpg", "zhangzetian.jpg", "songqian.jpg", "hangxiaozhu.jpg", "jingtian.jpg"
            , "liuyifei.jpg", "kangyikun.jpg", "dengziqi.jpg"};

    public SDManager(Context mContext) {
        this.mContext = mContext;
    }

    public void moveUserIcon() {
        String path = FileUtil.getRecentChatPath();
        InputStream is = null;
        FileOutputStream fos = null;
        for (int i = 0; i < names.length; i++) {
            try {
                is = mContext.getAssets().open(names[i]);
                fos = new FileOutputStream(new File(path + names[i]));
                int length = 0;
                byte[] buffer = new byte[1024];
                while ((length = is.read(buffer)) != -1) {
                    fos.write(buffer, 0, length);
                    fos.flush();
                }
                is.close();
                fos.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
